package test3;

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;

public class TestConnect {
	public static void main(String[] args) throws SQLException, ClassNotFoundException {
		Connection conn;
		 try {  
		        Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");  
		        conn = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=data_hotel","sa","123456789");           
		        System.out.println("Creating statement...");
		       Statement stmt = conn.createStatement();
		        String sql;
		        sql = "Insert into Category values('A1','Single')";
		        ResultSet rs = stmt.executeQuery(sql);
		            
		    } catch (ClassNotFoundException cnfe) { 
		        System.out.println("ss1");
		        //Code to handle the exception  
		    } catch (SQLException sqle) {  
		        //Code to handle the exception  
		        System.out.println("ss3");
		    }  
	}
}
